package day02;


public class DataTypDemo {
    public static void main(String[] args) {
        //小转大自动 大转小强制 需要在括号里面加类型 从右往左看兄弟

        /*
        int a = 5;
        long b = a;
        int c = (int) b;

        long d = 5;
        double e = 5;
        System.out.println(e);
        double x=11.20;
        int g=(int)x;
        System.out.println(g);
        long f =100000000000L;
        int t=(int)f;
        System.out.println(t);

        double p=9.87553;
        int r=(int)p;
        System.out.println(r);

        long u=99999999999L;
        int z = (int)u;
        System.out.println(z);

        int y = 5;
        long v = (long)y;
         */

        //byte short char 运算时自动转为int类型 所以从右往左看就是int变byte 所以强制改

        byte b1 = 2;
        byte b2 = 9;
        byte b3 = (byte) (b1 + b2);
        System.out.println(b3);

        short a1 = 7;
        short a2 = 8;
        short a3 = (short) (a1 + a2);
        System.out.println(a3);

        char c1 = 23;
        char c2 = 18;
        char c3 = (char) (c1 + c2);
        System.out.println(c3);

        short d1 = 7;
        short d2 = 8;
        short d3 = (short)(d1+d2);
        System.out.println(d3);


        System.out.println('2' + '2');//因为他是char 运算时char变为int char代码里面的2是数字50所以结果等于100
        System.out.println(2 + '2');//同上述 2+50
        System.out.println('2');//输出的就是2 因为没有进行运算  他不会从char变为int 所以就是单独的2

    }
}
